package com.levi.lambda;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author shentong
 * @date 2022/1/10 8:54 PM
 * @description
 */
public class StudnetDemo {
    public static void main(String[] args) {
        List<Student> studentList = new ArrayList<Student>(){{
            add(new Student(1, "张三", "男"));
            add(new Student(2, "李四", "男"));
        }};
        Student studentInfo = getStudentInfo(studentList);
        System.out.println(studentInfo);
    }


    public static Student getStudentInfo(List<Student> studentList){
        for (Student student : studentList) {
            if (Objects.equals(student.getName(),"张三")) {
                return student;
            }
        }
        return null;
    }
}
